package com.wyzz.hr.pojo;

import java.util.Calendar;
import java.util.Date;

import com.wyzz.hr.pojo.base.BaseEmpeval;
import com.wyzz.hr.util.DateUtil;

public class Empeval extends BaseEmpeval {

	public Empeval() {
	}

	public Empeval(String eeId) {
		super(eeId);
	}

	public static Date[] getStartEndDate(String eeType, Date date) {
		Date result[] = new Date[2];
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		if (eeType.compareTo("\u6708\u5EA6") == 0) {
			result[0] = DateUtil.getFirstDayInMonth(cal).getTime();
			result[1] = DateUtil.getLastDayInMonth(cal).getTime();
		} else if (eeType.compareTo("\u5B63\u5EA6") == 0) {
			result[0] = DateUtil.getFirstDayInQuartz(cal).getTime();
			result[1] = DateUtil.getLastDayInQuartz(cal).getTime();
		} else if (eeType.compareTo("\u534A\u5E74") == 0) {
			result[0] = DateUtil.getFirstDayInHalfYear(cal).getTime();
			result[1] = DateUtil.getLastDayInHalfYear(cal).getTime();
		} else if (eeType.compareTo("\u5168\u5E74") == 0) {
			result[0] = DateUtil.getFirstDayInYear(cal).getTime();
			result[1] = DateUtil.getLastDayInYear(cal).getTime();
		} else {
			result[0] = null;
			result[1] = null;
		}
		return result;
	}

	public Date[] getStartEndDate(Date date) {
		return getStartEndDate(getEeType(), date);
	}

	private static final long serialVersionUID = 1L;
}
